//
// Created by 31150 on 2024/6/8.
//

#ifndef HELPER_H
#define HELPER_H
#include <vector>
#include <iostream>
#include <cstring>

using namespace std;

#define debug(...)       debug_helper(#__VA_ARGS__, __VA_ARGS__)


template <typename T>
void printVector(vector<T>& vec) {
    cout << "[";
    for (int i = 0; i < vec.size(); i++) {
        if (i > 0) cout << ", ";
        cout << vec[i];
    }
    cout << "]" << endl;
}

template <typename T>
void print_matrix(vector<vector<T>>& matrix) {
    cout << "matrix: [" << endl;
    for (int i = 0; i < matrix.size(); i++) {
        cout << "  ";
        printVector(matrix[i]);
    }
    cout << "]" << endl;
}

template <typename T>
void debug_helper(const char* name, T value) {
    cout << name << " = " << value << std::endl;
}

template <typename T, typename... Args>
void debug_helper(const char* names, T value, Args... args) {
    const char* comma = strchr(names, ',');
    std::cout.write(names, comma - names) << " = " << value << ", ";
    debug_helper(comma + 1, args...);
}

#endif //HELPER_H
